package com.zixuan.gulicollege.service_order.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @classname: AliPayConfig
 * @author: zixuan
 * @date: 2021/5/28 19:33
 * @description:
 */
@Component
public class AliPayConfig implements InitializingBean {

    @Value("${ali-pay.app-id}")
    private String appId;

    @Value("${ali-pay.merchant-private-key}")
    private String merchantPrivateKey;

    @Value("${ali-pay.alipay-public-key}")
    private String aliPayPublicKey;

    @Value("${ali-pay.notify-url}")
    private String notifyUrl;

    @Value("${ali-pay.return-url}")
    private String returnUrl;

    @Value("${ali-pay.sign-type}")
    private String signType;

    @Value("${ali-pay.charset}")
    private String charset;

    @Value("${ali-pay.gateway-url}")
    private String gatewayUrl;

    @Value("${ali-pay.log-path}")
    private String logPath;

    public static String APP_ID;

    public static String MERCHANT_PRIVATE_KEY;

    public static String ALIPAY_PUBLIC_KEY;

    public static String NOTIFY_URL;

    public static String RETURN_URL;

    public static String SIGN_TYPE;

    public static String CHARSET;

    public static String GATEWAY_URL;

    public static String LOG_PATH;
    
    public static String FORMAT = "json";
    

    @Override
    public void afterPropertiesSet() throws Exception {
        APP_ID = this.appId;
        MERCHANT_PRIVATE_KEY = this.merchantPrivateKey;
        ALIPAY_PUBLIC_KEY = this.aliPayPublicKey;
        NOTIFY_URL = this.notifyUrl;
        RETURN_URL = this.returnUrl;
        SIGN_TYPE = this.signType;
        CHARSET = this.charset;
        GATEWAY_URL = this.gatewayUrl;
        LOG_PATH = this.logPath;
    }
}
